﻿# -*-coding:utf-8-*-
from ZIP_format.Csv2Db import select_mes_po
from file_export import EIP_files
from ZIP_format import zip_upload
from csv_format import csv_upload
import os
import sys
from utils import select_eip_po
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(BASE_DIR, 'process_files'))
sys.path.insert(0, os.path.join(BASE_DIR, 'ZIP_format'))


def run():
    eip_pos = []
    mes_pos = []
    pos = []
    for eip_po in select_eip_po():
        eip_pos.append(eip_po[0])
    for mes_po in select_mes_po():
        mes_pos.append(mes_po[0])
    for po in eip_pos:
        if po in mes_pos:
            pos.append(po)
    if EIP_files.run(pos):  # EIP导出
        return
    zip_upload.run()  # 罗技系统上传(ZIP格式)
    # zip_png_path = csv_upload.run()  # 罗技系统上传(CSV格式)


if __name__ == '__main__':
    # import argparse
    # parser = argparse.ArgumentParser()
    # parser.add_argument('--a', action='append')
    # for _, datas in parser.parse_args()._get_kwargs():
    #     if datas is not None:
    #         run(datas)
    run()